iPhone SDL 1.3 (SDL2) keyboard disappearing and misregistration issues.
I was having a couple of issues with the SDL keyboard on the iPhone. The first was that the keyboard disappears when you press enter, I didn’t want this. So I made the following change to SDL_uikitview.m:
/* Terminates the editing session */ - (BOOL)textFieldShouldReturn:(UITextField*)_textField { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); //SDL_StopTextInput(); return YES; }
However once I did this I was /sometimes/ getting the return key misregistering as either p or l. I found changing the keyboard for U.S. English to another language and then back again fixed the issue for the rest of the apps execution. The hack round this I finally put in place was to restart the TextInput in this method as follows:
/* Terminates the editing session */ - (BOOL)textFieldShouldReturn:(UITextField*)_textField { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); SDL_StopTextInput(); SDL_StartTextInput(); return YES; }